<template>
  <a-modal v-model="visible" :width="1080" title="选择用户的购物卡" @ok="batchSelectItem">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="8" :lg="7" :md="8" :sm="24">
            <a-form-item label="核销码">
              <a-input placeholder="请输入核销码" v-model="queryParam.code"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="8" :lg="7" :md="8" :sm="24">
            <a-form-item label="使用状态 ">
              <j-dict-select-tag v-model="queryParam.status" dictCode="	user_card_use_status"  />
            </a-form-item>
          </a-col>
          <a-col :xl="8" :lg="7" :md="8" :sm="24">
            <a-form-item label="创建时间">
              <a-range-picker format="YYYY-MM-DD" :placeholder="['开始时间', '结束时间']" @change="onDateChange" />
            </a-form-item>
          </a-col>
          <a-col :xl="8" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" icon="download" @click="handleExportXls('购物卡')" style="margin-left: 8px">导出</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- table区域-begin -->
    <div>

      <a-table ref="table" size="small" bordered rowKey="id" :columns="columns" :dataSource="dataSource" :pagination="ipagination" :loading="loading"
        class="j-table-force-nowrap" @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" height="55px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;" />
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
            下载
          </a-button>
        </template>

      </a-table>
    </div>

  </a-modal>
</template>

<script>

import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/MyJeecgListMixin'


export default {
  name: 'UmsMemberCardList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
  },
  data () {
    return {
      pageCheckedKeys: [],
      noPageCheckedKeys: [],
      pageCheckedRows: [],
      noPageCheckedRows: [],
      visible: false,
      description: '用户的购物卡管理页面',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '核销码',
          align: "center",
          dataIndex: 'code'
        },
        {
          title: '状态',
          align: "center",
          dataIndex: 'status_dictText'
        },
        {
          title: '核销用户昵称',
          align: "center",
          dataIndex: 'nickname'
        },
        {
          title: '手机号',
          align: "center",
          dataIndex: 'phone'
        },
        {
          title: '核销时间',
          align: "center",
          dataIndex: 'updateTime'
        }
      ],
      url: {
        list: "/mallPlus/umsMemberCard/list",
        delete: "/mallPlus/umsMemberCard/delete",
        deleteBatch: "/mallPlus/umsMemberCard/deleteBatch",
        exportXlsUrl: "/mallPlus/umsMemberCard/exportXls",
        importExcelUrl: "mallPlus/umsMemberCard/importExcel",

      },
      dictOptions: {},
    }
  },
  created () {
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    },
  },
  methods: {
    open (cardId, uid, nickname, phone) {
      if (cardId) {
        this.queryParam.cardId = cardId
      }
      if (uid) {
        this.queryParam.uid = uid
      }
      if (nickname) {
        this.queryParam.nickname = nickname
      }
      if (phone) {
        this.queryParam.phone = phone
      }
      this.loadData()
    },
    setSelected () {

    },
    initDictConfig () {
    }
  }
}
        </script>
<style scoped>
@import '~@assets/less/common.less';
</style>
